export default {
  data() {
    return {
      aboutCheck: {
        checkAll: false,
        checkAllGroup: [],
      },
    };
  },
  methods: {
    handleCheckAll() {
      this.aboutCheck.checkAll = !this.aboutCheck.checkAll;
      if (this.aboutCheck.checkAll) {
        const checkAllGroup = [];
        this.tablesList.forEach(item => {
          checkAllGroup.push(item.id);
        })
        this.aboutCheck.checkAllGroup = checkAllGroup;
      } else {
        this.aboutCheck.checkAllGroup = [];
      }
    },    
    checkAllGroupChange(data) {
      if (data.length === this.tablesList.length) {
        this.aboutCheck.checkAll = true;
      } else if (data.length > 0) {
        this.aboutCheck.checkAll = false;
      } else {
        this.aboutCheck.checkAll = false;
      }
    },
    resetCheckBox() {
      this.aboutCheck = {
        checkAll: false,
        checkAllGroup: [],
      };
    },
    selectNotWarn() {
      if (this.aboutCheck.checkAllGroup.length === 0) {
        this.$Message.error(this.$i18n.tc('views.public.pleaseChooseTarget'));
        return false;
      };      
      return true;
    }
  },
}